<%@ Page Language="VB" MasterPageFile="~/site.master" AutoEventWireup="false" codefile="MatchReport.aspx.vb" Inherits="MatchReport" %>
<%@ Register TagPrefix="wu" TagName="FixtureList" Src="../FixtureList.ascx" %>
<asp:Content ID="Content1" ContentPlaceHolderID="mainContent" Runat="server">
    <wu:FixtureList ID="FixtureList1" Runat="server" />
    <asp:Button ID="NewReport" runat="server" CssClass="buttonLink" Text="New Report" />
    
    <br /><br />
    <asp:sqldatasource id="SqlDataSource1" runat="server"
        selectcommand="SELECT [ReportID], [FixtureID], [Report], [MemberName] FROM [MatchReports] WHERE [FixtureID] = @FixtureID"
        DeleteCommand="DELETE FROM [MatchReports] WHERE [ReportID] = @ReportID"
        InsertCommand="INSERT INTO [MatchReports] ([FixtureID], [Report], [MemberName]) VALUES (@FixtureID, @Report, @MemberName)"
        UpdateCommand="UPDATE [MatchReports] SET [FixtureID] = @FixtureID, [Report] = @Report WHERE [ReportID] = @ReportID"
        connectionstring="<%$ ConnectionStrings:WroxUnited %>">
        <DeleteParameters>
            <asp:Parameter Type="Int32" Name="ReportID"></asp:Parameter>
        </DeleteParameters>
        <UpdateParameters>
            <asp:ControlParameter Name="FixtureID" Type="Int32" ControlID="FixtureList1" PropertyName="SelectedValue"></asp:ControlParameter>
            <asp:Parameter Type="String" Name="Report"></asp:Parameter>
            <asp:Parameter Type="Int32" Name="ReportID"></asp:Parameter>
        </UpdateParameters>
        <SelectParameters>
            <asp:ControlParameter Name="FixtureID" Type="Int32" ControlID="FixtureList1" PropertyName="SelectedValue"></asp:ControlParameter>
        </SelectParameters>
        <InsertParameters>
            <asp:ControlParameter Name="FixtureID" Type="Int32" ControlID="FixtureList1" PropertyName="SelectedValue"></asp:ControlParameter>
            <asp:Parameter Type="String" Name="Report"></asp:Parameter>
            <asp:ProfileParameter Name="MemberName" PropertyName="UserName" Type="String" />
        </InsertParameters>
    </asp:sqldatasource>
    <asp:detailsview id="DetailsView1" runat="server" BorderWidth="0"
        datasourceid="SqlDataSource1" autogeneraterows="False"
        datakeynames="ReportID">
        <Fields>
            <asp:BoundField ReadOnly="True" HeaderText="ReportID" InsertVisible="False"
                DataField="ReportID" SortExpression="ReportID" Visible="False"></asp:BoundField>
            <%--
            <asp:TemplateField SortExpression="FixtureID" HeaderText="FixtureID" insertVisible="false">
                <EditItemTemplate>
                    <asp:TextBox runat="server" Text='<%# Bind("FixtureID") %>' id="TextBox1"></asp:TextBox>
                </EditItemTemplate>
                <ItemTemplate>
                    <asp:Label runat="server" Text='<%# Bind("FixtureID") %>' id="Label1"></asp:Label>
                </ItemTemplate>
                <InsertItemTemplate>
                    <asp:TextBox runat="server" Text='<%# Bind("FixtureID") %>' id="TextBox1"></asp:TextBox>
                </InsertItemTemplate>
            </asp:TemplateField>
            --%>
            <asp:TemplateField SortExpression="Report" HeaderText="Report" HeaderStyle-VerticalAlign="top">
                <EditItemTemplate>
                    <asp:TextBox id=TextBox2 runat="server" Text='<%# Bind("Report") %>' Columns="75" Rows="10" TextMode="MultiLine"></asp:TextBox>
                </EditItemTemplate>
                <ItemTemplate>
                    <asp:Label runat="server" Text='<%# Bind("Report") %>' id="Label2"></asp:Label>
                </ItemTemplate>
                <InsertItemTemplate>
                    <asp:TextBox id=TextBox2 runat="server" Text='<%# Bind("Report") %>' Columns="75" Rows="10" TextMode="MultiLine"></asp:TextBox>
                </InsertItemTemplate>
            </asp:TemplateField>
            <asp:TemplateField SortExpression="MemberName" HeaderText="Report By">
                <ItemTemplate>
                    <%= User.Identity.Name %>
                </ItemTemplate>

                
            </asp:TemplateField>
            <asp:CommandField ShowDeleteButton="True" ShowInsertButton="true" ShowEditButton="True"></asp:CommandField>
        </Fields>
    </asp:detailsview></asp:Content>
